Correctly handle mpsmergeout option as a real binary option.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 6 Jan 2006 19:59:57 +0000 (19:59 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 6 Jan 2006 19:59:57 +0000 (19:59 +0000)
gpsbabel/mapsource.c

index a029285ca9f24b98f3ce9deb54ab67cd24d7b115..0e57d1be8139f43d6851c02e8168263360d7a6ab 100644 (file)
@@ -68,7 +68,8 @@ static short_handle read_route_wpt_mkshort_handle;
 char *snlen = NULL;
 char *snwhiteopt = NULL;
 char *mpsverout = NULL;
-char *mpsmergeout = NULL;
+char *mpsmergeouts = NULL;
+int   mpsmergeout;
 char *mpsusedepth = NULL;
 char *mpsuseprox = NULL;
 
@@ -80,7 +81,7 @@ arglist_t mps_args[] = {
        {"mpsverout", &mpsverout, 
                "Version of mapsource file to generate (3,4,5)", NULL,
                ARGTYPE_INT },
-       {"mpsmergeout", &mpsmergeout, "Merge output with existing file", 
+       {"mpsmergeout", &mpsmergeouts, "Merge output with existing file", 
                NULL, ARGTYPE_BOOL },
        {"mpsusedepth", &mpsusedepth, 
                "Use depth values on output (default is ignore)", NULL,
@@ -296,10 +297,14 @@ mps_rd_deinit(void)
 static void
 mps_wr_init(const char *fname)
 {
+       if (mpsmergeouts) {
+               mpsmergeout = atoi(mpsmergeouts);
+       }
+
        if (mpsmergeout) {
                mps_file_out = xfopen(fname, "rb", MYNAME);
                if (mps_file_out == NULL) {
-                       mpsmergeout = NULL;
+                       mpsmergeout = 0;
                }
                else {
                        fclose(mps_file_out);